package org.feiye.studyday14.practice;

public class Penguin {
	private String name;
	private int health;
	private int love;
	private String sex;

	public Penguin() {

	}

	public Penguin(String name, int health, int love, String sex) {
		this.name = name;
		this.health = health;
		this.love = love;
		this.sex = sex;
	}

	public void sexName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setHealth(int health) {
		if (health < 0 || health > 100) {
			System.err.println("健康值范围不合理！");
			health = 60;
		}
		this.health = health;
	}

	public int getHealth() {
		return health;
	}

	public void setLove(int love) {
		if (love < 0 || love > 100) {
			System.err.println("亲密值不合理！");
			love = 60;
		}
		this.love = love;
	}

	public int getLove() {
		return love;
	}

	public void setSex(String sex) {
		if (!(sex.equals("公") || sex.equals("母"))) {
			System.err.println("性别不合理！");
			sex = "公";
		}
		this.sex = sex;
	}

	public String getSex() {
		return sex;
	}

	public void introduction() {
		System.out.println(
				"我是一只名叫" + this.name + "的" + this.sex + "企鹅，" + "我的健康值是：" + this.health + "，我和主人的亲密度是：" + this.love);
	}
}
